#include "RoboterRaupe.h"
#include "Tempomat.h"
#include "TWI_Master.h"


uint8_t SetSpeed(int seite, int speed) {
	if (seite>2)
		return (2);  //Invalid Value for SetSpeed

    if (!TWIM_Start (15, TWIM_WRITE)){
		TWIM_Stop ();
		return (1); //Could not start TWI Bus for WRITE
    }

/*	if (speed > 154)
		Motor[seite].Richtung=1;
	else if (speed < 100)
		Motor[seite].Richtung=-1;
	else
		Motor[seite].Richtung=0;
*/
	TWIM_Write(255);
	TWIM_Write(seite);
	TWIM_Write(speed);
	TWIM_Stop ();
	return(0);
}

uint8_t SetSpeed2(void) {

    if (!TWIM_Start (15, TWIM_WRITE)){
		TWIM_Stop ();
		return (1); //Could not start TWI Bus for WRITE
    }

/*	if (speed > 154)
		Motor[seite].Richtung=1;
	else if (speed < 100)
		Motor[seite].Richtung=-1;
	else
		Motor[seite].Richtung=0;
*/
	TWIM_Write(Motor[0]);
	TWIM_Write(Motor[1]);
	TWIM_Stop ();
	return(0);
}


